/*
 * @Author: 橘子
 * @Date: 2021-10-08 21:30:09
 * @Project_description: 加载api
 * @Description: 代码是我抄的，不会也是真的
 */
import { request } from './service'

const files = require.context('./module', true, /\.api\.js$/)
let api = {}
//遍历模块名称
files.keys().forEach(key => {
  const moduleName = key.replace(/\.\/(.+)\.api\.js$/, '$1')
  const { default: module } = files(key)
  api[moduleName] = module({ request })
})
export default api
